<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            background-color: #bfa;
            width: 300px;
            height: 300px;
            display: flex;
            /* justify-content: center;
            align-items: center; */
        }

        .box2 {
            background-color: red;
            width: 100px;
            height: 100px;
            margin: auto;
            margin-top: 0;
            margin-bottom: 0;
            line-height: 300px;
        }
    </style>
</head>

<body>
    <div class="box1">
        <div class="box2"></div>
    </div>
</body>

</html>